package test;
  
import client.WeatherWSLocator;
import client.WeatherWSSoap_PortType;
import org.apache.axis.client.Service;
  
public class WeatherServiceClient {  
  
    public static void main(String[] args) {  
        try {  
            // 创建服务定位器实例  
            WeatherWSLocator locator = new WeatherWSLocator();
              
            // 获取服务端口实例  
            WeatherWSSoap_PortType port = locator.getWeatherWSSoap(new java.net.URL("http://ws.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl"));
              
            // 调用getWeather方法获取天气预报数据  (根据文档,默认情况下显示上海)
            String[] weatherData = port.getWeather("", "");
              
            // 打印天气预报数据  
            for (String data : weatherData) {  
                System.out.println(data);  
            }  
              
        } catch (Exception e) {  
            e.printStackTrace();  
            // 处理异常，例如记录日志或显示错误消息  
        }  
    }  
}